<template>
  <div>
    <div class="timeBox">
      <div>
        <h3>限时抢购</h3>
        <van-count-down :time="time">
          <template #default="timeData">
            <span class="block">{{ timeData.hours }}</span>
            <span class="block">{{ timeData.minutes }}</span>
            <span class="block">{{ timeData.seconds }}</span>
          </template>
        </van-count-down>
      </div>
      <div>更多</div>
    </div>
    <div class="qiang">
      <div class="horizontal-container">
        <div class="scroll-wrapper" ref="scroll">
          <div class="scroll-content">
            <div
              class="scroll-item"
              v-for="(item, index) in limit"
              :key="index"
            >
              <img v-lazy="item.small_image" alt="" />
              <div class="describe">{{ item.name }}</div>
              <div class="dibu">
                 <div class="price">{{ item.price }}</div>
                 <div class="guc"></div>
              </div>
             
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from "@better-scroll/core";
export default {
  name: "DaojiShi",
  data() {
    return {
      time: 30 * 60 * 60 * 1000,
    };
  },
  props: ["limit"],
  mounted() {
    this.init();
  },
  beforeDestroy() {
    this.bs.destroy();
  },
  methods: {
    init() {
      this.bs = new BScroll(this.$refs.scroll, {
        scrollX: true,
        probeType: 3, // listening scroll event
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.block {
  display: inline-block;
  width: 22px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background-color: #000;
  margin-left: 0.2rem;
}
.timeBox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.4rem;
  box-sizing: border-box;
  margin-top: 0.2rem;
  div:nth-child(1) {
    display: flex;
    align-items: center;
    font-size: 0.4rem;
  }
  div:nth-child(2) {
    font-size: 0.28rem;
    color: #44b861;
  }
}
.scroll-wrapper {
  position: relative;
  width: 90%;
  margin: 0 auto;
  white-space: nowrap;
  border-radius: 5px;
  overflow: hidden;
}
.scroll-content {
  width: 440%;
  display: inline-block;
}
.scroll-item {
  //   height: 50px;
  //   line-height: 50px;
  width: 7%;
  margin-top: 0.2rem;
  font-size: 24px;
  display: inline-block;
  text-align: center;
  padding: 0 10px;
  img {
    width: 2rem;
    height: 2rem;
  }
}
.describe {
  width: 100%;
  white-space: no-wrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 0.26rem;
}
.price {
  font-size: 0.32rem;
  color: red;
}
.dibu{
    width: 100%;
    height: .5rem;
    display: flex;
    align-items: center;
    justify-content: space-around;
    .guc{
        width: 25%;
        height: 90%;
        background: url("../../../../ps原图/assets/img/icon/1.png") no-repeat;
        background-size: 100% 100%;
    }
}
</style>